<!DOCTYPE html>
<html>
<!-- Mirrored from www.zi-han.net/theme/hplus/register.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:52 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>PG主题 s- 注册</title>

    <meta name="csrf-token" content="{{ csrf_token() }}">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/login/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/login/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/login/css/custom.css" rel="stylesheet">
    <link href="/login/css/animate.min.css" rel="stylesheet">
    <link href="/login/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">

    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
    <script src="/jquery/jquery.js"></script>
    <script src="/layui/layui.js"></script>
</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen   animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name">PG</h1>

        </div>
        <h3>欢迎注册 PG</h3>
        <p>创建一个PG新账户</p>
        <form class="m-t" action="" method="post" id="form">
            @csrf
            <div class="form-group">
                <input type="text" class="form-control" placeholder="请输入用户名" name="name" id="name" required="">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" placeholder="请输入密码" name="pwd" id="pwd" required="">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" placeholder="请再次输入密码" name="repwd" id="repwd" required="">
            </div>

            <button type="submit" id="submit" class="btn btn-primary block full-width m-b" style="background:#01AFF0;">注 册</button>

            <p class="text-muted text-center"><small>已经有账户了？</small><a href="login_index">点此登录</a>
            </p>
        </form>
    </div>
</div>
<script src="/login/js/icheck.min.js"></script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<script>
    $(function(){
        $('#submit').click(function () {
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
            var form = $('#form').serialize();
            var name =  $('#name').val();
            var pwd = $('#pwd').val();
            var repwd = $('#repwd').val();
            layui.use('layer', function() {
                var layer = layui.layer;
                if (!name) {
                    layer.msg('用户名不能为空');
                    location.href = '/register';
                    return false;
                }
                if (!pwd) {
                    layer.msg('密码不能为空');
                    location.href = '/register';
                    return false;
                }
                if (pwd.length < 6) {
                    layer.msg('密码不能小于六位');
                    location.href = '/register';
                    return false;
                }
                if (pwd.length > 16) {
                    layer.msg('密码不能大于十六位');
                    location.href = '/register';
                    return false;
                }
                if (!repwd) {
                    layer.msg('确认密码不能为空');
                    location.href = '/register';
                    return false;
                }
                if (repwd != pwd) {
                    layer.msg('密码不一致');
                    location.href = '/register';
                    return false;
                }
            });
            $.get({
                url:"register_add",
                data: form,
                success:function (data) {
                    layui.use('layer', function(){
                        var layer = layui.layer;
                        if(data.code=='1') {
                            layer.open({
                                title: '注册成功'
                                , skin: 'msg'
                                , content: data.name
                                , yes: function () {
                                    location.href = data.url;
                                }
                            });
                        }else if(data.code=='-1'){
                            layer.open({
                                title: '注册失败'
                                , skin: 'msg'
                                , content: data.name
                                , yes: function () {
                                    location.href = '/register';
                                }
                            });
                        }else if(data.code=='-2'){
                            layer.open({
                                title: '注册失败'
                                , skin: 'msg'
                                , content: data.name
                                , yes: function () {
                                    location.href = '/register';
                                }
                            });
                        }
                    });
                }
            });
            return false;
        });
    });
</script>
</body>
<!-- Mirrored from www.zi-han.net/theme/hplus/register.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:52 GMT -->
</html>

